using System.ComponentModel.DataAnnotations;
using LiteDB;

namespace PHMEE.VibrationDataGenerator.Data;

public class ChannelConfig
{
    public ObjectId Id { get; set; } = null!;

    [Required] public string Name { get; set; } = null!;

    /// <summary>
    /// 数据源类型
    /// </summary>
    [Required]
    public DataSrcType DataSrcType { get; set; }

    [Required] public string Topic { get; set; } = null!;

    public int ChNo { get; set; }

    public ChannelType ChType { get; set; }

    /// <summary>
    /// 方向
    /// </summary>
    [Required]
    public SernorStyleEnum Dir { get; set; }

    /// <summary>
    /// 振动指标
    /// </summary>
    public VibIndexEnum Code { get; set; }

    /// <summary>
    /// 数采器 Id（仅适用于 WeiLi 数据）
    /// </summary>
    public string DaqId { get; set; } = string.Empty;

    /// <summary>
    /// 数采器通道编号（仅适用于 WeiLi 数据）
    /// </summary>
    public DaqChNumber DaqChNumber { get; set; }
}

/// <summary>
/// 数据源类型
/// </summary>
public enum DataSrcType
{
    /// <summary>
    /// JianLong 数据
    /// </summary>
    JianLong = 0,

    /// <summary>
    /// WeiLi 数据
    /// </summary>
    WeiLi = 1
}

/// <summary>
/// 数采器通道编号
/// </summary>
public enum DaqChNumber
{
    /// <summary>
    /// 无。表示数据源不是 WeiLi 数据
    /// </summary>
    None = 0,

    AI0 = 1,
    AI1 = 2,
    AI2 = 3,
    AI3 = 4,
}

public enum ChannelType
{
    Vibration = 0,
    Speed = 1,
    Process = 2,
    Temperature = 3,
    Audio = 4,
    RTU = 5
}

// public enum Direction
// {
//     // None = 0,
//     Z = 1,
//     X = 2,
//     Y = 3
// }
//
// public enum IndicatorType
// {
//     LongWaveform = 1,
//     HighFrequencyAcceleration = 11,
//     LowFrequencyAcceleration = 12,
//     SpeedWaveform = 15
// }